package com.lzj.demo.design.chain;

import cn.hutool.core.util.StrUtil;
import com.lzj.demo.design.common.ServerResult;
import com.lzj.demo.design.vo.OrderQueryVO;
import org.springframework.stereotype.Component;
import org.springframework.core.annotation.Order;

/**
 * 参数校验对象
 **/
@Component
@Order(1) //顺序排第1，最先校验
public class CheckParamFilterObject extends AbstractHandler {
    @Override
    public ServerResult doFilter(OrderQueryVO request, ServerResult response) {
        System.out.println("非空参数检查");
        if(StrUtil.isEmpty(request.getOrderNo())){
            return response.setResult(1001,"订单号不能为空！");
        }
        return ServerResult.success();
    }
}
